package valerij_timakov.home_finances.web.costs;

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import valerij_timakov.home_finances.data.user.UserItem;
import valerij_timakov.home_finances.exceptions.AppExceptionNotAuthorized;

@ManagedBean (name="userBean")
@SessionScoped
public class UserBean implements Serializable {
	
private static final long serialVersionUID = 1L;

	private UserItem user = null;

	public UserItem getUser() throws AppExceptionNotAuthorized {
		if (user == null) {
			throw new AppExceptionNotAuthorized();
		}
		return user;
	}

	public void setUser(UserItem user) {
		this.user = user;
	}
	
	public boolean isAuthorized() {
		return user != null;
	}
	
	
}
